using UnityEngine;
using System.Collections;

public class Bomb : MonoBehaviour {
	
	public int explosionRange = 2;
	public float timeUntilDetonation = 2;	
	
	private GameEngine _engine;
	
	public void Setup ( GameEngine engine ){
		_engine = engine;
		Invoke("Explode",timeUntilDetonation);
	}
	public void Clear(){
		CancelInvoke("Explode");	
	}
	
	private void Explode(){
		_engine.DestroyBlocks(transform.position, explosionRange);
		Destroy(this.gameObject);
	}
}
